<template>
  <div>
    <ul>
      <li v-for="item in list" :key="item.id" >
        {{item.num}} <button @click="del(item.id)">删除</button>
      </li>
    </ul>
    <button @click="aa">生成</button>
  </div>
</template>

<script>
export default {
data(){
  return{
    list:[ {id:+new Date() , num:Math.floor(Math.random() * 20) }]
  }
},
methods:{
  aa(){
    this.list.push({id:+new Date() , num:Math.floor(Math.random() * 20) })
  },
  del(id){
    this.list = this.list.filter(item => item.id !=id)
  }
}
}
</script>

<style>

</style>